<?	
	require_once('./application/models/videoModel.php');
	class item_video extends item_abstract
	{	
	
		private $myModel;
		private $html;
		private $js;
	
		protected function init(){
		
			$this -> information['video'] ='';
			$this -> information['youtube_id'] = '';
			$this -> information['album_id'] = '';
			$this -> information['album_naam'] = '';
			$this -> information ['thumb'] = '';
			
			
			$this -> myModel = videoModel::getInstance($this -> Db);
			$this -> html = new view_htmlTag('div');
			$this -> html -> setText('You moet een flash player instaleren');
			$this -> js = new view_htmlTag('script');
			
		}
		
		
		
		public function insert(){
		
			return $this -> myModel -> insert($this);
		
		}
		public function update(){
			
			
			$this -> myModel -> updVideo($this);
			
		}
		
		public function getThumb(){
		
		$this -> myModel -> getThumb($this);
		
		}
		
		public function fill(){
		
			$this -> myModel -> fill($this);
			
		
		}
		
		
		public function render($x, $y){
			$this -> js -> setAttribute('type', 'text/javascript'); 
			$container = new view_htmlTag('div');
			$container -> setAttribute('class', 'youtube_container');
			$this -> html -> setAttribute('id', 'flashDiv_'.$this -> id);
			$this -> js -> setText('var params = { allowScriptAccess: "always" };
    								var atts = { id: "flashPlay_'.$this -> id.'" };
    								swfobject.embedSWF("http://www.youtube.com/v/'.$this -> youtube_id.'&amp;enablejsapi=1&amp;playerapiid=ytplayer", 
                       				"flashDiv_'.$this -> id.'", "'.$x.'", "'.$y.'", "8", null, null, params, atts);
						');
						
			
			$container -> addChild($this -> html);
				$container -> addChild($this -> js);
			$return = $container -> render();
			
			return $return;
			
		}
		public function verwijder()
		{
			$this -> myModel -> delVideos($this);
		}
		
	
	
	}


?>